class RecordResult {
  late int status;
  List sp = [];
  String transform = '';
  int duration = 0;
  RecordResult({
    required this.status,
    required this.sp,
    required this.transform,
    required this.duration,
  });
  RecordResult.success({
    required this.transform,
  }) {
    status = 0;
  }
  RecordResult.wait() {
    status = -1;
  }
  RecordResult.cancel() {
    status = 1;
  }
  RecordResult.fail() {
    status = 2;
  }

  String get des {
    return "$sp\n$transform";
  }

  Map<String, dynamic> get json {
    return {
      'status': status,
      'url': sp,
      'trans': transform,
      'duration': duration,
    };
  }

  Map<String, dynamic> get dataJson {
    return sp.isEmpty ? {} : sp.first
      ..['duration'] = duration
      ..['trans'] = transform;
  }
}
